package com.suoluo.zenapp.dao.zentravel;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

import com.suoluo.zenapp.vo.TripDayVO;
import com.suoluo.zenapp.vo.TripDestVO;
import com.suoluo.zenapp.vo.TripVO;

@DAO
public interface ZenDestDAO {

	@SQL("select t_dest_id id,t_dest_name name " +
			"from tb_travel_destination where t_dest_name_zh like :1")
	@SuppressWarnings("rawtypes")
	public List<Map> findZentravelDestByName(String destName);
	@SQL("select tf.t_feature_id id, tc.t_feature_category_name name " +
			"from tb_dest_feature tf join tb_dest_feature_category tc " +
			"on tf.t_feature_category_id = tc.t_feature_category_id " +
			" where tf.t_feature_dest_id=:1 ")
	@SuppressWarnings("rawtypes")
	public List<Map> findZentravelDestFeature(int destId);
	
	@SQL("select t_feature_item_id id, t_feature_item_title_zh name " +
			"from tb_dest_feature_item where t_feature_id=:1 " +
			"and t_feature_item_title like :2")
	@SuppressWarnings("rawtypes")
	public List<Map> findZentravelDestFeatureItem(int featureId,String itemTitle);
	@SQL("select tr.* from tb_trip tr join tb_trip_dest td " +
			"on tr.t_trip_id = td.t_trip_id where td.t_dest_id = :1 and tr.t_trip_enable = 1")
	public List<TripVO> findListTrips(int destId);
	

	@SQL("select * from tb_trip_dest  where t_trip_id = :1")
	public List<TripDestVO> findListTripDest(int tripId);
	
	@SQL("select * from tb_trip_days where t_trip_id = :1 order by t_trip_day ")
	public List<TripDayVO> findListTripDay(int tripId);
	
	@SuppressWarnings("rawtypes")
	@SQL("select ti.t_trip_item_id,ti.t_trip_item_order,ti.t_trip_day_id," +
			"tfi.t_pause_time,tfi.t_feature_item_title_en,tfi.t_feature_item_img_preffix," +
			"tfi.t_feature_item_img,tfi.t_lat,tfi.t_lng,tfi.t_feature_item_title_zh," +
			"tfi.t_feature_item_desc,tfi.t_feature_item_id,tfi.t_rel_id,"+
			"tfi.t_feature_item_summary,tc.t_feature_category_id," +
			"tc.t_feature_category_name,tc.t_feature_category_img " +
			"from tb_trip_item ti join tb_dest_feature_item  tfi on tfi.t_feature_item_id = ti.t_rel_id " +
			"join tb_dest_feature_category tc " +
			"on tc.t_feature_category_id = ti.t_feature_category_id " +
			"where ti.t_trip_id = :1 order by ti.t_trip_item_order asc")
	public List<Map> findListTripDayItem(int tripId);
}
